# 导包
from common.base import *


class Login(Base):
    # 定位用户名输入框
    def ipt_username(self, username):
        self.send_keys((By.NAME, 'username'), username)

    # 定位密码输入框
    def ipt_password(self, password):
        self.send_keys((By.NAME, 'password'), password)

    # 定位保存操作按钮
    def remember(self):
        self.click((By.ID, 'remember'))

    # 定位登录按钮
    def btn_login(self):
        self.click((By.CLASS_NAME, 'us_Submit'))


if __name__ == '__main__':
    ecshop = Login('chrome')
    ecshop.get('https://ecshop.test2.shopex123.com/user.php')
    ecshop.ipt_username('weilong')
    ecshop.ipt_password('666666')
    ecshop.remember()
    ecshop.btn_login()
    sleep(5)
    ecshop.browser_back()
    ecshop.browser_back()
    ecshop.quit(2)

